﻿using Prism.Regions;
using System.Windows;
using Prism.Ioc;

namespace MSDM.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            //给控件添加 指定名称的region,
            var regionManager = ContainerLocator.Current.Resolve<IRegionManager>();
            if (regionManager != null)
            {
                //经测试有效
                //SetRegionManager(regionManager, this.flyoutsControlRegion, RegionNames.FlyoutRegion);
                //SetRegionManager(regionManager, this.rightWindowCommandsRegion, RegionNames.RightWindowCommandsRegion);
            }
            // 设置全屏
            this.WindowState = System.Windows.WindowState.Normal;
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            double x = SystemParameters.WorkArea.Width;//得到屏幕工作区域宽度
            double y = SystemParameters.WorkArea.Height;//得到屏幕工作区域高度

            //this.Width = (int)(1920 / 3 * 2);
            //this.Height = (int)(1280 / 3 * 2);
            this.Width = x;
            this.Height = y;
        }

        private void SetRegionManager(IRegionManager regionManager, DependencyObject regionTarget, string regionName)
        {
            RegionManager.SetRegionName(regionTarget, regionName);
            RegionManager.SetRegionManager(regionTarget, regionManager);
        }
    }
}